@extends('layouts.app')

@section('content')
  <article>
    <div class="l_box">
      <div class="search">
        <form action="/e/search/index.php" method="post" name="searchform" id="searchform">
          <input name="keyboard" id="keyboard" class="input_text" value="请输入关键字词" style="color: rgb(153, 153, 153);" onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}" onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}" type="text">
          <input name="show" value="title" type="hidden">
          <input name="tempid" value="1" type="hidden">
          <input name="tbname" value="news" type="hidden">
          <input name="Submit" class="input_submit" value="搜索" type="submit">
        </form>
      </div>
        @include('layouts._left')

      <div class="cloud">
        <h2>标签云</h2>
        <ul>
          <a href="/">陌上花开</a> <a href="/">校园生活</a> <a href="/">html5</a> <a href="/">SumSung</a> <a href="/">青春</a> <a href="/">温暖</a> <a href="/">阳光</a> <a href="/">三星</a><a href="/">索尼</a> <a href="/">华维荣耀</a> <a href="/">三星</a> <a href="/">索尼</a>
        </ul>
      </div>
      <div class="guanzhu">
        <h2>关注我 么么哒</h2>
        <ul>
          <img src="/templates/boke/images/wx.jpg">
        </ul>
      </div>
    </div>
    <div class="infosbox">
      <div class="newsview">
        <h3 class="news_title">{{$article['title']}}</h3>
        <div class="bloginfo">
          <ul>
            <li class="author">作者：<a href="/">{{$article['author']}}</a></li>
            <li class="timer">时间：{{$article['created_at']}}</li>
            <li class="view">{{$article['click']}}人已阅读</li>
          </ul>
        </div>
        <div class="tags"><a href="/" target="_blank">个人博客</a> &nbsp; <a href="/" target="_blank">小世界</a></div>
        <div class="news_con"> {!! $article['content'] !!}
          &nbsp; </div>
      </div>
      <div class="share">
        <p class="diggit"><a href="JavaScript:makeRequest('/e/public/digg/?classid=3&amp;id=19&amp;dotop=1&amp;doajax=1&amp;ajaxarea=diggnum','EchoReturnedText','GET','');"> 很赞哦！ </a>(<b id="diggnum"><script type="text/javascript" src="/e/public/ViewClick/?classid=2&id=20&down=5"></script>13</b>)</p>
      </div>
      <div class="nextinfo">
        <p>上一篇：<a href="/news/life/2018-03-13/804.html">作为一个设计师,如果遭到质疑你是否能恪守自己的原则?</a></p>
        <p>下一篇：<a href="/news/life/">返回列表</a></p>
      </div>
      <div class="news_pl">
              <h2>文章评论</h2>
              <ul>
                  <div class="gbko" style="margin-top: 20px">
                  <form action="{{route('comment.store')}}"  method="post" id="frmSumbit"  >
                      @csrf
                      <input type="hidden" name="article_id" value="{{$article['id']}}">
                      <p>
                          <textarea name="content" id="txaArticle" class="pinglungonggao text" cols="50" rows="4" tabindex="5"></textarea>
                      </p>
                      <p>
                          <button  type="submit"  class="button">提交评论</button>
                      </p>
                  </form>
                  </div>


                  <div style="padding:10px;margin-top: 20px" id="pinlun">
                      @foreach($comments as $v)
                            <div class="msg" id="cmt1107389">
                                <div class="msgtxt">
                                    <div class="msgtxtbogy">
                                        <div class="msgname">
                                            <a href="" rel="nofollow" target="_blank">
                                                <font color="#CC0000" style="margin-left: 15px;line-height: 40px">{{$v->user->name}}</font>
                                            </a>&nbsp;&nbsp;{{$v['created_at']->diffForHumans()}}</div>

                                        <div class="msgarticle" style="margin-left: 15px">
                                            {{$v['content']}}
                                        </div>
                                    </div>
                                </div>
                            </div>
                          @endforeach
                   </div>


              </ul>
      </div>

    </div>
  </article>
@endsection

<script>
    window.onload = function ()
    {
        var obj=null;
        var As=document.getElementById('nav').getElementsByTagName('a');
        obj = As[0];
        for(i=1;i<As.length;i++){if(window.location.href.indexOf(As[i].href)>=0)
            obj=As[i];}
        obj.id='selected'
    }

</script>
<script type="text/javascript">

    $(document).ready(function(e) {
        t = $('.guanzhu').offset().top;

        mh = $('.infosbox').height();
        fh = $('.guanzhu').height();

        $(window).scroll(function(e){
            s = $(document).scrollTop();
            if(s > t - 10){
                $('.guanzhu').css('position','fixed');
                $('.guanzhu').css('background','fff');
                if(s + fh > mh){
                    $('.guanzhu').css('top',mh-s-fh+'px');
                }
            }else{
                $('.guanzhu').css('position','');
            }

        })
    });

</script>
</html>
